﻿using CL.Business.BLL;
using CL.Business.Entity;
using CL.Tools.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CL.UnionWeb.union
{
    public partial class NoticeDetail : System.Web.UI.Page
    {
        protected NoticeEntity noticeItem = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            string strID = Request.QueryString["noticeID"];
            if (!string.IsNullOrEmpty(strID))
            {
                long noticeID = 0;
                long.TryParse(DESEncrypt.Decrypt(strID), out noticeID);
                if (0 < noticeID) //有效消息ID
                {
                    NoticeBLL bll = new NoticeBLL();
                    noticeItem = bll.GetNotice(noticeID);
                    if(null != noticeItem)
                    {
                        bll.ReadNotice((int)noticeID);

                    }
                    else
                    {
                        ErrorReturn();
                    }
                }
                else
                {
                    ErrorReturn();
                }
            }
            else
            {
                ErrorReturn();
            }
        }

        protected void ErrorReturn()
        {
            Response.Write("<script >alert(\"" + "打开失败!" + "\");location.href='/union/MyNotice.aspx';</script>");
        }
    }
}